//
//  VC6Transition.swift
//  ChapterAll
//
//  Created by Kevin on 2020/4/27.
//  Copyright © 2020 Kevin. All rights reserved.
//

import UIKit

class VC6Transition: UIViewController {
    
    let margin:CGFloat = 16
    
    lazy var blueView = { ()-> UIView in
        let ui = UIView()
        ui.frame = CGRect(x: margin, y: 100, width: view.frame.width - margin * 2, height: view.frame.height - 100 - margin)
        ui.backgroundColor = UIColor.blue
        return ui
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
        view.addSubview(blueView)
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        let transition = CATransition()
        transition.type = .init(rawValue: "oglFlip")
        transition.subtype = .fromLeft
        blueView.layer.add(transition, forKey: nil)
    }
}
